package com.lin.boot.thread;

import lombok.ToString;

/**
 * @author: linjiang
 * @date: 2024/11/18
 */
@ToString
public class ToolkitErrorContext {

    private static final ThreadLocal<ToolkitErrorContext> LOCAL = ThreadLocal.withInitial(ToolkitErrorContext::new);

    private Object resource;

    public static ToolkitErrorContext instance() {
        return LOCAL.get();
    }

    public static void clear() {
        LOCAL.remove();
    }

    public ToolkitErrorContext resource(Object resource) {
        this.resource = resource;
        return this;
    }

}
